home *** CD-ROM | disk | FTP | other *** search
Text File | 1987-10-16 | 4.8 KB | 111 lines | [TEXT/MSWD] |
- ____________________________________________________________________
-
- 4th Dimension Technical Notes
-
- #7 Loading 4th Dimension's Scrollable Area Variable
-
- Written by Ron Dell'Aquila July 22, 1987
-
- Published August 1, 1987
- ____________________________________________________________________
-
- This technote describes how to load a scrollable area variable with formatted
- information.
- ___________________________________________________________
-
- When using the scrollable area variables with 4th Dimension, you can simultaneously view the
- contents of more than one list per input layout at the same time. Scrollable areas offer the user
- the ability to position the highlighted row anywhere in the scrollable region as well as decide
- where the end of the scrollable information will be under program control .
-
-
-
- In the above illustration, the scrollable area is called "vExpenses".
-
-
- Initially define a scrollable area by creating a variable with the attribute "Scrollable Area" onto
- your layout. In this example, the variable is named "vExpenses".
-
- To load the array, create a WHILE loop where both the array pointer and current record pointer
- both increment for each iteration of the loop.
-
- In the above example, notice there are 6 fields of information displayed for each line of the array.
- Each field for every represented record must be concatenated together to form the contents of
- each line of the array.
-
- Scrollable areas do not currently honor the TAB (CHAR(09)) horizontal position character, so it is
- up to the user to position the information so it 'loooks goood.' The formatting is controlled entirely
- by the field formatting statements STRING and SUBSTRING functions in conjunction with a
- monospaced character font such as Courier.
-
- continued...
- #7: Loading 4th Dimension's Scrollable Area Variable Page #p of 2
-
- #7: Loading 4th Dimension's Scrollable Area Variable Page #p of 2
-
-
-
- MESSAGES OFF
- ALL RECORDS([Expenses])
- `Find all the RECEIPTS which belong to the current TRIP and match the desired ran
- SEARCH BY INDEX([Expenses]TripNo=[Trip]TripNumber;[Expenses]Receipt No±0;vLastRecNo)
- `Initilize the line index pointer
- i:=1
- vSpace:=" "*2
- `Begin the scrollable area loader loop
- While (Not(End selection([Expenses]))
- `Create array elements to be used for each row
- `Note each following element must be of a consistant length regardless of it
- vExpenses:=String([Expenses]Receipt No;"000")
- `Convert boolean field REIMBURSEABLE to display either "Yes" or "No", 3 chars in length
- vRemb:=Substring("YesNo ";[Expenses]Reimburseable*4;3)
- `date field to be 10 characters in length
- vDate:=Substring(String([Expenses]Expense Date)+(" "*10);1;10)
- `catagory field to be 15 charactersin length
- vCatagory:=Substring([Expenses]Category+(" "*15);1;15)
- `description field to be 20 characters in length
- vDesc:=Substring([Expenses]Description+(" "*20);1;20)
- `convert the numeric AMOUNT field into a formatted string variable
- vActlAmount:=String([Expenses]Amount;"$#,###.00")
- `right justify the string of AMOUNT. Stuff spaces before the amount.
- vAmount:=(Substring(" "*10;1;10-Length(vActlAmount))+(vActlAmount))
- `concantenate the above elements for each value of index {i}
- vExpenses{i}:=vExpenses+vSpace+vRemb+vSpace+vDate+vSpace+vCatagory+vSpace+vDesc+vAmount
- `increment index i
- i:=i+1
- `load the next record in the current selection
- NEXT RECORD([Expenses])
- `repeat until there are no more records in the current selection
- End while
- `define the numberof rows to be visible in the array: store the value in array element{0}
- vExpenses{0}:=i-1
- `highlight the first row in the array
- vExpenses:=1
- MESSAGES ON
-
- To define how many lines are to be in the scrollable area, assign the desired value to the variable
- "vExpenses{0}", usually done after the loading process.
-
- To Determine which line will be highlighted after loading the array, assign the row number desired
- to the variable "vExpenses". Simmilarly, if you want to read which line is highlighted, read the
- value of "vExpenses".
-
- Additionally, if you would like to display data from the selected row in an on screen variable, just
- assign a variable the contents of vExpenses{vExpenses}. For example:
- vDisplay:=vExpenses{vExpenses}.
-
- Using the techniques outlined in 4D Technote #9, it is possible to detect where a double click has
- occurred within the scrollable area.
-
-
-
-
-
-
- #7: Loading 4th Dimension's Scrollable Area Variable Page #p of 2
-
-
-
-
-